package com.slz3.business.module.orderManagement.ordOrderLine.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.orderManagement.ordOrderLine.domain.OrdOrderLine;
import com.slz3.business.module.orderManagement.ordOrderLine.domain.OrdOrderLineFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class OrdOrderLineTransactionalServiceImpl implements OrdOrderLineTransactionalService {

    @Override
    public OrdOrderLine modify(OrdOrderLine ordOrderLineNew) {
        Repositorys.ordOrderLine.test();
        Repositorys.ordOrderLine.save(OrdOrderLineFactory.initBaseFields());
        System.err.println(1/0);
        ordOrderLineNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.ordOrderLine.saveAndFlush(ordOrderLineNew);
    }

    @Override
    public List<OrdOrderLine> batchModify(List<OrdOrderLine> ordOrderLineList) {
        return Repositorys.ordOrderLine.saveAll(ordOrderLineList);
    }
}
